package com.dongbao.action;

import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.openapi.project.DumbAware;
import org.jetbrains.annotations.NotNull;

public class DHGCodeAction extends ToggleAction implements DumbAware {
    public static final String PROP_NAME = "ImagePlugin.borderVisible";

    public static boolean isBorderVisible() {
        return PropertiesComponent.getInstance().getBoolean(PROP_NAME, false);
    }

    @Override
    public boolean isSelected(@NotNull AnActionEvent e) {
        return isBorderVisible();
    }

    @Override
    public void setSelected(@NotNull AnActionEvent e, boolean state) {
        PropertiesComponent.getInstance().setValue(PROP_NAME, state);
    }
}